home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2006 May
/
PCWMAY06.iso
/
Software
/
Freeware
/
First Page 2006 3.00
/
fp2006-final-3.00-setup.exe
/
{app}
/
Iscripts
/
Forms Misc
/
no-dupes.izs
< prev
next >
Wrap
Text File
|
2005-09-28
|
4KB
|
176 lines
<!NOWIZARD>
<!TITLE>No Duplicates
<!/TITLE>
<!DESCRIPTION>Prevents you from selecting the same choice when choosing from two different pulldown menus. <!/DESCRIPTION>
<!CATEGORY>Forms<!/CATEGORY>
<!SCRIPT>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL NO DUPLICATES:
1. Copy code into the HEAD section of document
2. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Denis Dijon (ddijon@hotmail.com) -->
<!-- Web Site: http://213.177.134.20 -->
<!-- Begin
var OptLstTxt = new Array;
var OptLstVal = new Array;
var OptLen = 0;
function NoDupl(SelObjFrom, SelObjTo) {
var OldToVal = SelObjTo.options[SelObjTo.selectedIndex].value;
if (OptLen == 0) {
OptLen = SelObjFrom.length;
for (var i = 1; i < OptLen; i++) {
OptLstTxt[i] = SelObjFrom.options[i].text;
OptLstVal[i] = SelObjFrom.options[i].value;
}
}
var j = 1;
for (var i = 1; i < OptLen; i++) {
if (OptLstVal[i] != SelObjFrom.options[SelObjFrom.selectedIndex].value) {
if (j == SelObjTo.length) {
SelObjTo.options[j] = new Option(OptLstTxt[i]);
}
else {
SelObjTo.options[j].text = OptLstTxt[i];
}
SelObjTo.options[j].value = OptLstVal[i];
if (OptLstVal[i] == OldToVal) {
SelObjTo.selectedIndex = j;
}
j++;
}
}
if (SelObjTo.length > j)
SelObjTo.options[(SelObjTo.length - 1)] = null;
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Add code into BODY section of document -->
<BODY>
<form method="POST" name="MForm">
Try to select the same color:
<br>
<select name="Color_1" onChange="NoDupl(this,document.MForm.Color_2)">
<option selected value=''>Select your first prefered color</option>
<option value='R'>Red</option>
<option value='J'>Yellow</option>
<option value='G'>Green</option>
<option value='B'>Blue</option>
</select>
<select name="Color_2" onChange="NoDupl(this,document.MForm.Color_1)">
<option selected value=''>Select Second Prefered color</option>
<option value='R'>Red</option>
<option value='J'>Yellow</option>
<option value='G'>Green</option>
<option value='B'>Blue</option>
</select>
</form>
<!-- END OF SCRIPT -->
<!/SCRIPT>
<!PREVIEW>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL NO DUPLICATES:
1. Copy code into the HEAD section of document
2. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Denis Dijon (ddijon@hotmail.com) -->
<!-- Web Site: http://213.177.134.20 -->
<!-- Begin
var OptLstTxt = new Array;
var OptLstVal = new Array;
var OptLen = 0;
function NoDupl(SelObjFrom, SelObjTo) {
var OldToVal = SelObjTo.options[SelObjTo.selectedIndex].value;
if (OptLen == 0) {
OptLen = SelObjFrom.length;
for (var i = 1; i < OptLen; i++) {
OptLstTxt[i] = SelObjFrom.options[i].text;
OptLstVal[i] = SelObjFrom.options[i].value;
}
}
var j = 1;
for (var i = 1; i < OptLen; i++) {
if (OptLstVal[i] != SelObjFrom.options[SelObjFrom.selectedIndex].value) {
if (j == SelObjTo.length) {
SelObjTo.options[j] = new Option(OptLstTxt[i]);
}
else {
SelObjTo.options[j].text = OptLstTxt[i];
}
SelObjTo.options[j].value = OptLstVal[i];
if (OptLstVal[i] == OldToVal) {
SelObjTo.selectedIndex = j;
}
j++;
}
}
if (SelObjTo.length > j)
SelObjTo.options[(SelObjTo.length - 1)] = null;
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Add code into BODY section of document -->
<BODY>
<form method="POST" name="MForm">
Try to select the same color:
<br>
<select name="Color_1" onChange="NoDupl(this,document.MForm.Color_2)">
<option selected value=''>Select your first prefered color</option>
<option value='R'>Red</option>
<option value='J'>Yellow</option>
<option value='G'>Green</option>
<option value='B'>Blue</option>
</select>
<select name="Color_2" onChange="NoDupl(this,document.MForm.Color_1)">
<option selected value=''>Select Second Prefered color</option>
<option value='R'>Red</option>
<option value='J'>Yellow</option>
<option value='G'>Green</option>
<option value='B'>Blue</option>
</select>
</form>
<!-- END OF SCRIPT -->
<!/PREVIEW>
<!RELATED>NONE<!/RELATED>